$Message=$class.create("$util.Message");
$Message.Message.prototype={

	getInstance : 
	function(divId){
		var myObj = new $Message();
		if(divId)myObj.setMsgNode(divId);
		return myObj;
	},
		
	initialize : 
	function(){
		this.icons = new HashMap();
		this.msgNode = null;
		this.divNode = null;
		this.icoNode = null;
		this.hideEvent = null;;
		this.initIcons();
	},

	initIcons : 
	function(){
		var icons = this.icons;
			icons.put("icon.info",	 "/common/images/success.gif");
			icons.put("icon.warn",	 "/common/images/warning.gif");
			icons.put("icon.fail",	 "/common/images/failure.gif");
			icons.put("icon.failure","/common/images/failure.gif");
			icons.put("icon.success","/common/images/success.gif");
			icons.put("icon.ok",	 "/common/images/success.gif");
			icons.put("icon.no",	 "/common/images/failure.gif");
	},

	setMsgNode : 
	function(nodeOrId){
		if(nodeOrId) this.msgNode = getContainer(nodeOrId);
	},
	setDivNode : 
	function(nodeOrId){
		if(nodeOrId) this.divNode = getContainer(nodeOrId);
	},
	setIcoNode : 
	function(nodeOrId){
		if(nodeOrId) this.icoNode = getContainer(nodeOrId);
	},
	setHideEvent : 
	function(evt){
		this.hideEvent = evt;
	},

	getMsgNode : 
	function(){
		if(!this.msgNode) this.msgNode = getContainer(CONSTANTS.get("message.container"));
		return this.msgNode;
	},
	getDivNode : 
	function(){
		if(!this.divNode) this.divNode = this.getMsgNode().parentNode;
		return this.divNode;
	},
	getIcoNode : 
	function(){
		if(!this.icoNode) this.IcoNode = this.getDivNode().getElementsByTagName("IMG")[0];
		return this.icoNode;
	},
	getHideEvent : 
	function(){
		if(!this.hideEvent){
			this.hideEvent = CONSTANTS.get("message.event.hide");
		}
		return this.hideEvent.toLowerCase();
	},

	show : 
	function(msg,ico){
		if(msg){
			if( ico ){
				this.getIconNode().src = getContextBase()+this.icons.get("icon."+ico.toLowerCase());
			}
			this.getMsgNode().innerHTML = msg;
			var evt = this.getHideEvent();
			var divCantainer = this.getDivNode();
				divCantainer.style.display="block";
				divCantainer.title=msg+"\r\n\r\n隱藏本提示: "+I18N.get("event."+evt,evt);
				divCantainer.attachEvent(evt,function(){divCantainer.style.display="none"});
				divCantainer.focus();
		}else{
			this.hide();
		}
	},

	hide : 
	function(){
		this.getMsgNode().innerHTML="";
		this.getDivNode().style.display="none";
	}

}

var $ll_message = new $Message();

//@depriiated by Messahe Class;
function showMessage(msg,cantainerId,hiddenEvent,ico){
	var obj = $ll_message.getInstance(cantainerId);
	obj.setHideEvent(evt);
	obj.show(msg, ico);
}

function reConfirm(title){
 	var removeMsg = title+"\n!\n此操作不可撤销,确定要继续吗?\n ";
 		removeMsg += "\nThis operation can't be recovered;\nDo you really want to continue?";
 	return window.confirm(removeMsg);
}
